//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

namespace Microsoft.Research.ScientificWorkflow.ManagementStudioControls.RegistryManagerModule
{
    using System.Windows;
    using System.Windows.Input;
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class AddCredential : Window
    {
        public AddCredential()
        {
            InitializeComponent();
            this.brdrHeader.MouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs e) { this.DragMove(); };
        }

        private void OnNameChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
        {
            AddCredentialPresenter presenter = this.DataContext as AddCredentialPresenter;
            if (presenter != null && presenter.NameChangesCommand != null)
            {
                presenter.NameChangesCommand.Execute(null);
            }
        }

        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            this.txtName.Focus();
        }
    }
}
